﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebSE
{
    public class ActPage
    {
        private string picURL;          //图片URL
        private string chatContent;     //对话内容
        private bool isChatPage;        //是否对话页面
        private string userID;          //用户id***********************************************新增
        private int pageID;             //页面id***********************************************新增
        
        private int proID;              //题目id
        private int problemType;        //题目类型，1为单选题，2为多选题，3为填空题
        private string problem;         //题目
        
        private string[] choices;       //选择题选项，固定4个
        private int countChsAns;        //选择题答案个数
        private int[] chsAns;           //选择题答案，0、1、2和3表示选A、B、C和D
        private string[] explainChs;    //选择题答案解释，每个选项都要给出解释
        private int[] userChsAns;       //用户答案***********************************************新增

        private int countFillAns;       //填空题空格个数
        private int[] countSimilar;     //每个空的答案数
        private string[,] fillAns;      //填空题答案，每个空可能多个类似的答案
        private string explainFill;     //填空题答案解释
        private string[] userFillAns;   //用户答案***********************************************新增

        //构造函数
        public ActPage(int pageNum)
        {
            picURL = "bird.jpg";
            chatContent = "This is the office.";
            isChatPage = false;

            proID = 1;
            problemType = 3;
            problem = "This is a multiple choices problem.";

            choices = new string[4];
            choices[0] = "a";
            choices[1] = "b";
            choices[2] = "c";
            choices[3] = "d";
            countChsAns = 2;
            chsAns = new int[2];
            countChsAns = 2;
            chsAns[0] = 1;
            chsAns[1] = 2;
            explainChs = new string[4];
            explainChs[0] = "a is not right";
            explainChs[1] = "b is right";
            explainChs[2] = "c is right";
            explainChs[3] = "d is not right";

            countFillAns = pageNum;
            countSimilar = new int[4];
            countSimilar[0] = 1;
            countSimilar[1] = 2;
            countSimilar[2] = 3;
            countSimilar[3] = 4;
            fillAns = new string[4,4];
            fillAns[0, 0] = "blank1:answer 1";
            fillAns[1, 0] = "blank2:answer 1";
            fillAns[1, 1] = "blank2:answer 2";
            fillAns[2, 0] = "blank3:answer 1";
            fillAns[2, 1] = "blank3:answer 2";
            fillAns[2, 2] = "blank3:answer 3";
            fillAns[3, 0] = "blank4:answer 1";
            fillAns[3, 1] = "blank4:answer 2";
            fillAns[3, 2] = "blank4:answer 3";
            fillAns[3, 3] = "blank4:answer 4";
            explainFill += "blank1:answer 1 is rigth.";
            explainFill += "blank2:answer 1 is right.";
            explainFill += "blank2:answer 2 is right.";
            explainFill += "blank3:answer 1 is not right.";
            explainFill += "blank3:answer 2 is not right.";
            explainFill += "blank3:answer 3 is right.";

            userChsAns = new int[4];
            userFillAns = new string[4];
        }

        //设置页面对象的各个属性
        public bool setPage(int pageNum)
        {
            return isChatPage;
        }
        
        public string setUserID(string uid)
        {
            userID = uid;
            return userID;
        }
        public int setPageID(int pid)
        {
            pageID = pid;
            return pageID;
        }
        public void setUserChsAns(int uca, int index)
        {
            userChsAns[index] = uca;
        }
        public void setUserFillAns(string ufa, int index)
        {
            userFillAns[index] = ufa;
        }

        public string getPicURL()
        {
            return picURL;
        }
        public string getChatContent()
        {
            return chatContent;
        }
        public bool getPageType()
        {
            return isChatPage;
        }
        public int getProblemType()
        {
            return problemType;
        }
        public string getProblem()
        {
            return problem;
        }
        public string getChoices(int index)
        {
            return choices[index];
        }
        public string[] getExplainChs()
        {
            return explainChs;
        }
        public int[] getChsAns()
        {
            return chsAns;
        }
        public int getCountChsAns()
        {
            return countChsAns;
        }
        public int getCountFillAns()
        {
            return countFillAns;
        }
        public string getExplainFill()
        {
            return explainFill;
        }
        public string[,] getFillAns()
        {
            return fillAns;
        }
        public int[] getCountSimilar()
        {
            return countSimilar;
        }
        public int[] getUserChsAns()
        {
            return userChsAns;
        }
        public string[] getUserFillAns()
        {
            return userFillAns;
        }
        
        public void writeDataBase()
        {

        }
    }
}
